<template>
	<view>
		<view style="width: 100%;height: 50rpx;background-color:brown;">
			<view style="margin-left: 30rpx;line-height: 50rpx;color: white;">
				{{searchType}}
			</view>
		</view>
		<view>
			<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-left">
				<view v-for="item in dataList" style="width: 100%; ;">
					<uni-card :title="item.username" :sub-title="item.fullAddress"  :thumbnail="item.profilePath"  @click="onClick">
						<view style="font-size: 35rpx;">
							{{item.name}}
						</view>
						<view>
							&nbsp;&nbsp;{{item.desc}}
						</view>
						<view>
							<image :src="item.imagePath" mode="aspectFit" style="width: 100%;"></image>
						</view>
					</uni-card>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script setup>
import {onShow}from "@dcloudio/uni-app"
import { ref } from "vue"
	import {
		baseUrl
	} from '../../static/js/common.js'
	const dataList=ref([])
	const searchType=ref("")
	
	onShow(()=>{
		const type=sessionStorage.getItem("userRecordType")
		let userStr=localStorage.getItem('userInfo')
		if(userStr==null){
			uni.showToast({
				icon:'error',
				title:'请先登录'
			})
			return
		}
		let userInfo=JSON.parse(userStr)
		let requestType='';
		if(type==1){
			searchType.value="历史流浪动物"
			requestType='animal'
		}else if(type==2){
			searchType.value="历史领养期望"
			requestType='post'
		}
		let params={
			pageIndex:1,
			pageSize:6,
			userId:userInfo.id
			// regionId:regionId
		}
		console.log("start")
		uni.request({
			url: baseUrl + '/'+requestType+'/list',
			method:'POST',
			data:params,
			success: (res) => {
				dataList.value = res.data.data.result
			}
		})
	})
</script>

<style scoped>
	       
</style>
